﻿using MediatR;
using S.Eartag.Domain.Model;
using S.Eartag.Infrastructure.Interface;
using S.Eartag.Read.API.Application.Command.SheepFileConditionCommand;

namespace S.Eartag.Read.API.Application.CommandHandlers.SheepFileConditionCommandHandler
{
    public class SheepFileConditionarownCommandHandler : IRequestHandler<SheepFileConditionarownCommand, List<SheepFile>>
    {
        private readonly ISheepFileRepository sheepFileRepository;

        public SheepFileConditionarownCommandHandler(ISheepFileRepository sheepFileRepository)
        {
            this.sheepFileRepository = sheepFileRepository;
        }
        /// <summary>
        /// 没有条件的所有档案信息
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<List<SheepFile>> Handle(SheepFileConditionarownCommand request, CancellationToken cancellationToken)
        {
            return sheepFileRepository.All().Result.ToList();
        }
    }
}
